<template>
  <div class="bigs">
    <detail-header></detail-header>
    <detail-lunbo :list="descName" :banners="banner" :gallery="gallery"></detail-lunbo>
    <detail-contens :list="conpenList" :conList="admitList"></detail-contens>
    <detail-detail-top :list="lastList"></detail-detail-top>
    <detail-commment :list="galleryImg2" :comList="commmitImg"></detail-commment>
  </div>
</template>

<script>
import DetailHeader from './coments/Header.vue'
import DetailLunbo from './coments/Lunbo.vue'
import DetailContens from './coments/Contens.vue'
import axios from 'axios'
import DetailDetailTop from './coments/DetailTop.vue'
import DetailCommment from './coments/Commment.vue'
export default {
  name: 'detail',
  components: {
    DetailHeader,
    DetailLunbo,
    DetailContens,
    DetailDetailTop,
    DetailCommment
  },
  data () {
    return {
      conpenList: [],
      admitList: [],
      descName: '',
      banner: '',
      gallery: [],
      lastList: [],
      galleryImg2: [],
      commmitImg: []
    }
  },
  methods: {
    getDetailInfo () {
      axios.get('/localdata/detail2.json', {
        params: {
          id: this.$route.params.id
        }
      })
        .then((response) => {
          this.getDetailSuccess(response)
        })
        .catch(() => {
        })
    },
    getDetailSuccess (response) {
      let dataObj = response.data// 获取json里的数据
      let dataList = dataObj.data// 获取列表里的数据
      if (dataObj.ret && dataList) {
        this.conpenList = dataList.contensList
        this.admitList = dataList.admitList
        this.descName = dataList.nameList
        this.banner = dataList.bannerImg
        this.gallery = dataList.galleryImg
        this.lastList = dataList.lastList
        this.galleryImg2 = dataList.galleryImg2
        this.commmitImg = dataList.commmitImg
      }
    }
  },
  mounted () {
    this.getDetailInfo()
  }
}
</script>

<style lang="stylus" scoped="scoped">
  .bigs
    background #F5F5F5
</style>
